import serverApiMockUtils from '../utils/serverApiMockUtils'
import CaptchaComponentConfigResponse from '@/core/captcha/types/model/response/CaptchaComponentConfigResponse'
import mockProdServerUtils from '../utils/mockUtils'
import captchaAdminApiConfig from '@/core/captcha/generated/apiconfig/captchaAdminApiConfig'

const content: CaptchaComponentConfigResponse[] = []
for (let i = 0; i < 10; i++) {
	const componentType = Math.floor(Math.random() * 2) + 1 === 1 ? 'kaptcha' : 'easy_captcha'
	let config = '{"s":"s"}'
	if (componentType === 'easy_captcha') {
		config =
			Math.floor(Math.random() * 2) + 1 === 1
				? config
				: '{"width":20,"height":500,"length":8,"arithmeticLength":2,"captchaType":"DEFAULT_CAPTCHA","font":"FONT_2","captchaCharType":"TYPE_ONLY_NUMBER"}'
	}
	content.push({
		id: i.toString(),
		componentType: componentType,
		config: config,
		deleteFlag: '0',
		createTime: new Date().getTime().toString(),
		updateTime: new Date().getTime().toString(),
		rowVersion: 1,
	} as CaptchaComponentConfigResponse)
}

const mockList = [...serverApiMockUtils.getDefaultServerApi(captchaAdminApiConfig.captchaComponentConfig, content)]

mockProdServerUtils.addPriorityMockList(1, ...mockList)
